package com.htthorizon.common.datasource.config;

import com.htthorizon.common.datasource.handler.InsertOrUpdateHandler;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author Brilliant
 */
@Configuration
public class MybatisConfig {

    @Autowired
    private SqlSessionFactory sqlSessionFactory;

    @Autowired
    private InsertOrUpdateHandler insertOrUpdateHandler;


    public void myInterceptor(){
        sqlSessionFactory.getConfiguration().addInterceptor(insertOrUpdateHandler);
    }
}
